//
//  ElectricChargeRequest.m
//  EasyToo
//
//  Created by YuanDee on 13-9-14.
//
//

#import "ElectricChargeRequest.h"

@implementation ElectricChargeRequest
-(id)initWithClientId:(NSString *)clientId
        andClientName:(NSString *)clientName
          andBillDate:(NSString *)billDate
        andBillMonths:(NSString *)billMonths
          andTotalFee:(NSString *)totalFee
             Delegate:(id<ServerCommunicationDelegate>)delegate
{
    self = [super init];
    if(self)
    {
        self.requestName = @"ElectricChargeRequest";
        self.delegate = delegate;
        self.url = PROTOCOL_ORDER_URL;
        
        [self.headerJsonDict setObject:@"007002" forKey:@"TranCode"];
        [self.headerJsonDict setObject:totalFee forKey:@"TxAmt"];
        
        [self.bodyJsonDict setObject:@"36194472" forKey:@"TerminalNo"];
        [self.bodyJsonDict setObject:@"TGZYZT001" forKey:@"ContactNo"];
        [self.bodyJsonDict setObject:@"21218cca77804d2ba1922c33e0151105" forKey:@"password"];
        [self.bodyJsonDict setObject:@"4701" forKey:@"ReqCode"];

        NSMutableDictionary *entry_dict2 = [[[NSMutableDictionary alloc] init] autorelease];
        [entry_dict2 setObject:totalFee forKey:@"TotalAmt"];
        [entry_dict2 setObject:billMonths forKey:@"PayMonths"];
        [entry_dict2 setObject:clientId forKey:@"ClientID"];
        [entry_dict2 setObject:clientName forKey:@"ClientName"];
        [entry_dict2 setObject:@"PC711"forKey:@"Operator"];
        [entry_dict2 setObject:billDate forKey:@"PayMonth"];
        [self.bodyJsonDict setObject:entry_dict2 forKey:@"ReqData"];
        
        [self.headerJsonDict setObject:[NSString stringWithFormat:@"%d", totalFee.intValue] forKey:@"TxAmt"];
        [self buildJsonRequest];
    }
    return self;

}

-(void)dealloc
{
    [super dealloc];
}
@end
